package com.jet.merchant.gate;

import com.jet.core.result.ResultJson;
import com.jet.merchant.domain.vo.MerchantStoreVo;
import com.jet.merchant.service.IMerchantStoreService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/gate/merchant/merchant-store")
public class GateMerchantStoreController {

    private final IMerchantStoreService merchantStoreService;

    public GateMerchantStoreController(IMerchantStoreService merchantStoreService) {
        this.merchantStoreService = merchantStoreService;
    }

    @GetMapping("/list")
    public ResultJson<List<MerchantStoreVo>> list(@RequestHeader long merchantNo,
                                                  @RequestHeader long storeNo,
                                                  @RequestHeader String accountId) {
        List<MerchantStoreVo> result = merchantStoreService.findAllByStoreNos(merchantNo, null);
        return ResultJson.ok(result);
    }
}
